import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;

import javax.swing.JFrame;
import javax.swing.JPanel;

public class PanelClass extends JPanel{
	public PanelClass(JFrame f){
		this.setBackground(Color.gray);
	}
	
	@Override
	public void paint(Graphics g){
		Graphics2D g2d = (Graphics2D)g;
		super.paint(g2d);
		g2d.setColor(Color.black);
		g2d.fillRect(480, 340, 50, 50);
	}
	
	public static void main(String[]args){
		JFrame frame = new JFrame();
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.setSize(1024, 720);
		frame.setResizable(false);
		PanelClass pc = new PanelClass(frame);
		frame.add(pc);
		frame.setVisible(true);
	}
}
